package cn.wubo.vrr.help.service.impl;

import cn.wubo.vrr.help.entity.Award;
import cn.wubo.vrr.help.repository.AwardRepo;
import cn.wubo.vrr.help.service.AwardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AwardServiceImpl implements AwardService {
    @Autowired
    AwardRepo awardRepo;

    @Override
    public List<Award> saveOrUpdateAll(List<Award> list) {
        if(list.size() > 0){
            Award query = new Award();
            query.setEMPLID(list.get(0).getEMPLID());
            awardRepo.deleteAll(awardRepo.findAll(Example.of(query)));
            list = awardRepo.saveAll(list);
        }
        return list;
}
}
